
#ifndef CORE_H_
#define CORE_H_

#ifdef _WIN32
#	ifndef _SECURE_SCL
#		define _SECURE_SCL		0	// disable checked iterators
#	endif
#	define _CRTDBG_MAP_ALLOC
#	define __STDC_LIMIT_MACROS
#	include <cstdlib>
#	define WIN32_LEAN_AND_MEAN
#	define STRICT
#	ifndef NOMINMAX
#		define NOMINMAX
#	endif
#	include <windows.h>
#	include <stdint.h>
#else
#	include <sys/time.h>
#	include <stdarg.h>
#endif

#ifdef __IPHONE_3_0
#   include <OpenGLES/ES2/gl.h>
#   include <OpenGLES/ES2/glext.h>
#else
#   include <GLES2/gl2.h>
#   include <EGL/egl.h>
#endif

#include <vector>
#include <cstdio>
#include <cassert>
#include <cfloat>
#include <new>
#include <iostream>
#include <ostream>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stdexcept>
/*
 * http://www.boost.org/
 */
#include <boost/type_traits.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/functional/hash.hpp>
#include <boost/unordered_map.hpp>
#include <boost/foreach.hpp>
#include <boost/pool/pool_alloc.hpp>

#define foreach(a,b)            BOOST_FOREACH(a,b)
#define reverse_foreach(a,b)    BOOST_REVERSE_FOREACH(a,b)

// compiler_warning.h
// REF: http://stackoverflow.com/questions/471935/user-warnings-on-msvc-and-gcc
#define STRINGISE_IMPL(x)       #x
#define STRINGISE(x)            STRINGISE_IMPL(x)

// Use: #pragma message WARN("My message")
#if _MSC_VER
#   define FILE_LINE_LINK       __FILE__ "(" STRINGISE(__LINE__) ") : "
#   define WARN(exp)            (FILE_LINE_LINK "WARNING: " exp)
#else//__GNUC__ - may need other defines for different compilers
#   define WARN(exp)            ("WARNING: " exp)
#endif

#define MAX_MESSAGE_BYTES       2048U
#define NULL_INDEX              (int32)-1
#define UNUSED(x)				((void)(x))

#ifndef WIN32
#	define _snprintf        	snprintf
#	define _vsnprintf       	vsnprintf
#else
#endif

namespace p2 {

typedef double real64;
typedef float real32;
typedef int64_t int64;
typedef uint64_t uint64;
typedef int32_t int32;
typedef uint32_t uint32;
typedef int16_t int16;
typedef uint16_t uint16;
typedef int8_t int8;
typedef uint8_t uint8;
typedef std::string String;

#if defined(_USE_DOUBLE_PRECISION)
typedef real64 real;
#else
typedef float real;
#endif

}

#include "RealTimeType.h"
#include "Exception.h"
#include "Timer.h"
#include "Debug.h"

#endif	//CORE_H_
